package com.bzframework.movierecommend.client.tmdb.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties("movie.tmdb")
public class TMDBConfiguration {

    private String baseUrl = "https://api.themoviedb.org/3";

    /**
     * 使用tmdb必填
     * @url <a href="https://www.themoviedb.org/settings/api">...</a>
     */
    private String apiKey;

    /**
     * w92 / w154 / w185 适用于海报在列表或网格布局中展示，文件较小，加载快
     * w342 / w500 适用于海报在详情页或需要较大显示时
     * w780 / w1280 / original 适用于背景图，因其宽度较大，能覆盖大部分屏幕
     * h632 适用于演员头像，固定高度为632像素
     * example: https://image.tmdb.org/t/p/w500/{path}
     */
    private String baseImageUrl = "https://image.tmdb.org/t/p";

    public String withPosterUrl(String posterPath) {
        return baseImageUrl + "/w500/" + posterPath;
    }

    public String withBackupUrl(String posterPath) {
        return baseImageUrl + "/w1280/" + posterPath;
    }

}
